<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>后台管理</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="csrf-token" content="{{ csrf_token() }}">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="/lib/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="/css/admin.css" media="all">
	</head>
	<body>
        <div class="layui-fluid">
			<div class="layui-col-md12">
				<div class="layui-navs">
					<span class="layui-breadcrumb" lay-separator="—">
						<a href="javascript:;">内容管理</a>
						<a href="javascript:;">文章管理</a>
						<a><cite>文章列表</cite></a>
					</span>
					<a class="layui-btn layui-btn-small" style="line-height:1.6em;float:right;height: 36px;" href="javascript:location.replace(location.href);" title="刷新">
						<i class="layui-icon layui-icon-refresh" style="line-height:36px;font-size: 16px;"></i>
					</a>
				</div>
			</div>
			<div class="layui-col-md12">
				<div class="layui-card">
					<div class="layui-card-body ">
						<form class="layui-form layui-col-space5">
							<div class="layui-inline layui-show-xs-block">
								<select name="article_category_id" lay-filter="article_category_id">
									<option value="0" selected="selected">请选择文章分类</option>
                                    @foreach($category as $item)
                                        @if($item->id == $category_id)
                                            <option value="{{$item->id}}" selected="selected">{{$item->name}}</option>
                                        @else
                                            <option value="{{$item->id}}" >{{$item->name}}</option>
                                        @endif
                                    @endforeach

								</select>
							</div>
{{--							<div class="layui-inline layui-show-xs-block">--}}
{{--								<input type="text" name="start_time" id="start_time" value="" placeholder="请选择开始时间" autocomplete="off" class="layui-input">--}}
{{--							</div>--}}
{{--							<div class="layui-inline layui-show-xs-block">--}}
{{--								<input type="text" name="end_time" id="end_time" value="" placeholder="请选择结束时间" autocomplete="off" class="layui-input">--}}
{{--							</div>--}}
							<div class="layui-inline layui-show-xs-block">
								<input type="text" name="title" value="{{$title}}"  placeholder="请输入ID、名称" autocomplete="off" class="layui-input">
							</div>
							<div class="layui-inline layui-show-xs-block">
								<button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
							</div>
						</form>
					</div>
					<div class="layui-card-header">
						<button class="layui-btn" onclick="execute_open('添加文章', 'article_operation.html', '1000', '800')"><i class="layui-icon"></i>添加文章</button>
					</div>
					<div class="layui-card-body">
						<table class="layui-table layui-form">
							<thead>
								<tr>
									<th>序号</th>
									<th>ID</th>
									<th>文章标题</th>
									<th>文章分类</th>
									<th>文章封面</th>
									<th>阅读数</th>
									<th>点击数</th>
									<th>置顶</th>
									<th>推荐</th>
									<th>状态</th>
									<th>发布时间</th>
									<th>管理</th>
								</tr>
							</thead>
							<tbody>
                            @foreach($data as $value)
                                <tr>
                                    <td>1</td>
                                    <td>{{$value->id}}</td>
                                    <td>{!! str_replace($title,"<font color='red'>$title</font>",$value->title) !!}</td>
                                    <td>{{$value->name}}</td>
                                    <td><img src="{{$value->image}}" style="width: 100px;height: 60px;border-radius: 5px;"></td>
                                    <td>{{$value->read}}</td>
                                    <td>{{$value->like}}</td>
                                    <td>{{$value->read}}</td>
                                    <td>
                                        @if($value->is_first== 1)
                                            <input type="checkbox" name="switch" lay-skin="switch" value="1" data-url="/admin/changeIsFirst" data-type="istop" data-id="{{$value->id}}" title="置顶" lay-text="置顶|不置顶" checked></td>
                                        @else
                                            <input type="checkbox" name="switch" lay-skin="switch" value="1" data-url="/admin/changeIsFirst" data-type="istop" data-id="{{$value->id}}" title="置顶" lay-text="置顶|不置顶"></td>
                                        @endif


                                    <td><input type="checkbox" name="switch" lay-skin="switch" value="3" data-url="" data-type="status" data-id="{$vo.id}" title="状态" lay-text="显示|隐藏" {if $vo.status == 0}checked="checked" {/if}></td>
                                    <td>2020-3-30</td>
                                    <td>
                                        <a class="layui-btn layui-btn-sm layui-btn-normal" title="编辑" onclick="execute_open('编辑文章类型', 'article_operation.html?id=1', 1000, 800)" href="javascript:;"><i class="layui-icon layui-icon-edit"></i>编辑</a>
                                        <a class="layui-btn layui-btn-sm layui-btn-danger" title="删除" data-id="{{$value->id}}" onclick="execute_del(this, {{$value->id}}, '/admin/articleDel')" href="javascript:;"><i class="layui-icon layui-icon-delete"></i>删除</a>
                                    </td>
                                </tr>
                            @endforeach

							</tbody>
						</table>
					</div>
					<div class="page" style="text-align: center">
						<ul class="pagination">
							{{$data->appends(['article_category_id' => $category_id,'title' => $title])->links()}}
						</ul>
					</div>
				</div>
			</div>
        </div>
    </body>
</html>
<script src="/js/jquery-3.4.1.min.js"></script>
<script src="/lib/layui/layui.js"></script>
<script src="/js/admin.js"></script>
